Developer Documentation
PATHJava Developer Documentation > Mac OS Runtime for Java > MRJToolkit > Programming With MRJToolkit


Methods


setDefaultFileType

Sets the default file type for the Java application.

public static void setDefaultFileType (
                     MRJOSType defaultType);
defaultType
The 4-byte file type you wish to assign as the default.

DISCUSSION

On the Mac OS, a file type is a 4-byte character constant that identifies the type of file to the Finder (for example, 'TEXT' for a text file, or 'APPL' for an application). If you do not specify a default file type, any saved files will have the file type 'TEXT' .

SEE ALSO

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about file types.


setDefaultFileCreator

Sets the default creator for the Java application.

public static void setDefaultFileCreator (
                     MRJOSType defaultCreator);
defaultCreator
The 4-byte creator you wish to assign as the default.

DISCUSSION

On the Mac OS platform, the creator is a 4-byte character constant that the Finder uses to identify the application that should open a document. The application itself has the same creator as its documents. If you do not specify a default creator, any saved files will have the current application's creator.

SEE ALSO

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about creators.


setFileTypeAndCreator

Sets the file type and creator of an existing Mac OS file.

public static final void setFileTypeAndCreator (
                     File file,
                     MRJOSType type,
                     MRJOSType creator)
                     throws IOException;
file
The file whose file type and creator you want to set.
type
The 4-byte file type you want to assign.
creator
The 4-byte creator you wish to assign.

DISCUSSION

On the Mac OS, a file type is a 4-byte character constant that identifies the type of file to the Finder (for example, 'TEXT' for a text file, or 'APPL' for an application). A creator is a 4-byte character constant that the Finder uses to identify the application that created a document; doing so allows the Finder to launch or activate the appropriate application when the document is opened.

SEE ALSO

The setFileType method setFileType .

The setFileCreator method setFileCreator .

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about file types and creators.


setFileType

Sets the file type for an existing Mac OS file.

public static final void setFileType (
                     File file,
                     MRJOSType type)
                     throws IOException;
file
The file whose file type you want to set.
type
The 4-byte file type you wish to assign.

DISCUSSION

On the Mac OS, a file type is a 4-byte character constant that identifies the type of file to the Finder (for example, 'TEXT' for a text file, or 'APPL' for an application). This method throws IOException if the desired file cannot be found.

SEE ALSO

The setFileTypeAndCreator method setFileTypeAndCreator .

The setFileCreator method setFileCreator .

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about file types.


setFileCreator

Sets the creator for an existing Mac OS file.

public static final void setFileCreator (
                     File file,
                     MRJOSType creator)
                     throws IOException;
file
The file whose creator you want to set.
creator
The 4-byte creator you wish to assign as the default.

DISCUSSION

On the Mac OS, a creator is a 4-byte character constant that the Finder uses to identify the application that should be used to open the document file. This method throws IOException if the desired file cannot be found.

SEE ALSO

The setFileTypeAndCreator method setFileTypeAndCreator .

The setFileType method setFileType .

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about creators.


getFileType

Gets the file type of an existing Mac OS file.

public static final MRJOSType getFileType (
                     File file)
                     throws IOException;
file
The file whose file type you want to obtain.
method result
The 4-byte file type of the file.

DISCUSSION

On the Mac OS platform, a file type is a 4-byte character constant that identifies the type of file to the Finder (for example, 'TEXT' for a text file, or 'APPL' for an application). This method throws IOException if the desired file cannot be found.

SEE ALSO

The setFileTypeAndCreator method setFileTypeAndCreator .

The setFileType method setFileType .

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about file types.


getFileCreator

Gets the creator of an existing Mac OS file.

public static final MRJOSType getFileCreator (
                     File file)
                     throws IOException;
file
The file whose creator you want to obtain.
method result
The 4-byte creator of the file.

DISCUSSION

On the Mac OS, a creator is a 4-byte character constant that the Finder uses to identify the application that should open the document file. If the desired file cannot be found, this method throws IOException .

SEE ALSO

The setFileTypeAndCreator method setFileTypeAndCreator .

The setFileCreator method setFileCreator .

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about creators.


findFolder

Returns the path to a special Mac OS folder.

public static File findFolder (MRJOSType
                     folderType)
                     throws FileNotFoundException;
folderType
The folder you are looking for. For the list of constants you can specify in this parameter, see Special Folder Constants .
method result
The file object that references the folder you specified.

DISCUSSION

The Mac OS has several special folders that applications often need to access (for example, the Preferences folder); this method searches the startup volume for the desired folder and returns the path. If the folder cannot be found, the method throws FileNotFoundException .

SEE ALSO

The "File Manager" chapter in Inside Macintosh: Files.


findApplication

Returns the path to an application.

public static File findApplication (
                     MRJOSType applSig)
                     throws FileNotFoundException;
applSig
The 4-byte creator of the application you are looking for.
method result
The file object that references the application you specified.

DISCUSSION

This method searches all local disks for the application. The search algorithm is identical to that used by the Finder. If the application cannot be found, the method throws FileNotFoundException .

SEE ALSO

The "Finder Interface" chapter in Inside Macintosh: Macintosh Toolbox Essentials for information about search paths and creators.


© 1998 Apple Computer, Inc. — (Last Updated 10 Dec 98)